package com.example.lenovo.localphotos_lxy.common;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

/**
 * Created by lenovo on 2017/10/19.
 */

public abstract class BaseActivity extends Activity{

    public Activity mActivity;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.mActivity=this;
        if(getLayoutId()!=0){
            setContentView(getLayoutId());
        }
        initView();
        initData();
        setListener();
    }


    protected abstract void initView();

    protected abstract void initData();

    public abstract int getLayoutId() ;

    protected abstract void setListener();

    public <T extends View> T obtainView(int resId){
        return (T)findViewById(resId);
    }


}
